package net.com.sunkey.messagehandler;

import java.nio.ByteBuffer;

import net.com.sunkey.protobuf.Protocol;
import net.com.sunkey.protobuf.UserLeaveResponse.UserLeaveResponseData;
import net.com.sunkey.serverlogic.Server;

/**
 * @author kohachiro
 *
 */
public class UserLeaveResponseHandler {
	/**
	 * 
	 */
	//@Override
	public static int invoke(Object data, Object channel) throws Exception {
		System.out.println("["+channel.hashCode()+"]["+Protocol.MessageHandler.UserLeaveResponse_VALUE+"]UserLeaveResponse");	
		UserLeaveResponseData.Builder builder=UserLeaveResponseData.newBuilder();
		builder.setUserid((int)data);	
		UserLeaveResponseData message=builder.build();
		
		Server.sendResponse(Protocol.MessageHandler.UserLeaveResponse_VALUE, ByteBuffer.wrap(message.toByteArray()), channel);
		return Protocol.MessageHandler.UserLeaveResponse_VALUE;
	}
}
